package com.example.rocketmq.timewheel.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.UUID;

/**
 * 定时任务模型
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ScheduledTask {
    // 任务ID，默认生成UUID
    private String taskId = UUID.randomUUID().toString();
    
    // 任务类型
    private String taskType;
    
    // 任务执行参数
    private String taskParam;
    
    // 任务延迟执行时间（毫秒）
    private long delay;
    
    // 任务预计执行时间戳
    private long executeTime;
    
    // 任务创建时间
    private long createTime = System.currentTimeMillis();
    
    public ScheduledTask(String taskType, String taskParam, long delay) {
        this.taskType = taskType;
        this.taskParam = taskParam;
        this.delay = delay;
        this.executeTime = System.currentTimeMillis() + delay;
    }
}
